// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from "vue";
import App from "./App";
import router from "./router";

//引入axios
import axios from "axios";
//引入elementUI
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
Vue.use(ElementUI);

//添加请求拦截器
axios.interceptors.request.use(config => {
  config.headers["authen_token"] =
    "eyJhbGciOiJIUzI1NiJ9.eyJ7YWNjb3VudElkPTF9IjozMCwiZXhwIjoxNzAwNzI0MDU3fQ.X2TMloMUv8YoUatt5LGIJog04Qs_1Up6OgnWMvzygSc";
  return config;
});

//设置默认路径
axios.defaults.baseURL = "http://localhost:9001";

//2.将axios绑定到vue的原型对象上
Vue.prototype.$http = axios;

Vue.config.productionTip = false;

/* eslint-disable no-new */
new Vue({
  el: "#app",
  router,
  components: { App },
  template: "<App/>"
});
